package cn.ddiancan.xddcloud.psc.flow.feign;

import java.util.List;

import cn.ddiancan.xddcloud.psc.flow.entity.XddTaskActor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 任务参与者数据访问层接口
 */
@FeignClient(contextId = "XddTaskActorService", name = "xddcloud-flow-server")
public interface XddTaskActorRemoteService {

    @PostMapping("/flow/taskActor/insert")
    boolean insert(XddTaskActor taskActor);

    @DeleteMapping("/flow/taskActor/deleteById/{id}")
    boolean deleteById(@PathVariable("id") Long id);

    @DeleteMapping("/flow/taskActor/deleteByIds")
    boolean deleteByIds(@RequestBody List<Long> ids);

    @DeleteMapping("/flow/taskActor/deleteByTaskId/{taskId}")
    boolean deleteByTaskId(@PathVariable("taskId") Long taskId);

    @DeleteMapping("/flow/taskActor/deleteByTaskIds")
    boolean deleteByInstanceIds(@RequestBody List<Long> instanceIds);

    @DeleteMapping("/flow/taskActor/deleteByTaskIdAndAgentType/{taskId}/{agentType}")
    boolean deleteByTaskIdAndAgentType(@PathVariable("taskId") Long taskId, @PathVariable("agentType") int agentType);

    @DeleteMapping("/flow/taskActor/deleteByTaskIdAndAgentTypes/{taskId}")
    boolean deleteByTaskIdAndActorIds(@PathVariable("taskId") Long taskId, @RequestBody List<String> actorIds);

    @PutMapping("/flow/taskActor/updateById")
    boolean updateById(@RequestBody XddTaskActor taskActor);

    @GetMapping("/flow/taskActor/selectById/{instanceId}")
    List<XddTaskActor> selectListByInstanceId(@PathVariable("instanceId") Long instanceId);

    @GetMapping("/flow/taskActor/selectById/{taskId}")
    List<XddTaskActor> selectListByTaskId(@PathVariable("taskId") Long taskId);

    @PostMapping("/flow/taskActor/selectListByTaskIds")
    List<XddTaskActor> selectListByTaskIds(@RequestBody List<Long> taskIds);

    @GetMapping("/flow/taskActor/selectListByTaskIdAndActorId/{taskId}/{actorId}")
    List<XddTaskActor> selectListByTaskIdAndActorId(@PathVariable("taskId") Long taskId, @PathVariable("actorId") Long actorId);

    @GetMapping("/flow/taskActor/selectListByTaskIdAndAgentType/{taskId}/{agentType}")
    Long selectCountByTaskIdAndActorId(@PathVariable("taskId") Long taskId, @PathVariable("actorId") Long actorId);
}
